Inside Microsoft SharePoint 2013 by Scot Hillier

Inside Microsoft SharePoint 2013 by Scot Hillier

Author:Scot Hillier
Language: eng
Format: epub
Tags: COMPUTERS / Enterprise Applications / Collaboration Software
ISBN: 9780735674455
Publisher: Microsoft Press
Published: 2013-11-19T00:00:00+00:00


There is a dual aspect to programming documents in a document library. Though you can program against a document library by using an SPList object, you can also program against a document by using an SPListItem object. However, each document is also represented in the server-side object with an SPFile object. That means you can program against a document in a document library as either an SPListItem or SPFile object. You can obtain the file associated with an item through the File property by using either server-side or client-side code.

The SPListItem object can be used to read or update fields just as you would read or update fields for an item in a standard list. The SPFile object, on the other hand, can be used to control other aspects of the document, such as versioning, check-in, and checkout, as well as reading from and writing to the document’s content.

When the server-side object model is used, the contents of the document can be accessed through the SPFile.OpenBinaryStream method. When the managed client object model is used, the contents can be accessed through the File.OpenBinaryDirect and File.SaveBinaryDirect methods. When the REST API is used, the contents are accessed by referencing the file followed by the $value method, as shown here:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.